package com.neusoft.hifly.core.token;

/**
 * 请求类型
 */
public enum TokenMethod {

	ALL("ALL"),

	GET("GET"),

	POST("POST"),

	PUT("PUT"),

	DELETE("DELETE"),

	PATCH("PATCH");

	private String state;

	TokenMethod(final String state) {
		this.state = state;
	}

	/**
	 * 根据状态字符串获取token状态枚举对象
	 *
	 * @param tokenState
	 *            枚举信息
	 * @return TokenState信息
	 */
	public static TokenMethod getTokenState(final String tokenState) {
		final TokenMethod[] states = TokenMethod.values();
		TokenMethod ts = null;
		for (final TokenMethod state : states) {
			if (state.toString().equals(tokenState)) {
				ts = state;
				break;
			}
		}
		return ts;
	}

	@Override
	public String toString() {
		return this.state;
	}

	public String getState() {
		return state;
	}

}
